home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / msdos / animutil / fastgfx / fg303b / manuals.arj / USERAPP.DOC < prev   
Encoding:
Text File  |  1993-10-02  |  61.1 KB  |  1,330 lines

  1. Appendix A
  2.  
  3.  
  4.  
  5.  
  6.  
  7. Fastgraph Utilities
  8.  
  9. 310   Fastgraph User's Guide
  10.  
  11.  
  12.  
  13. Overview
  14.  
  15.      This appendix describes the utility programs supplied with Fastgraph.
  16. By default, the Fastgraph installation procedure places these utilities in
  17. the \FG directory.  To use these utilities, you must either (1) copy the .EXE
  18. file from \FG to your current directory, (2) make \FG your current directory,
  19. or (3) include the \FG directory in your DOS path specification.
  20.  
  21.  
  22. SNAPSHOT Utility
  23.  
  24.      The SNAPSHOT utility is a terminate and stay resident program (TSR) to
  25. capture graphic images.  It stores the image in Fastgraph's standard pixel
  26. run format.  To load SNAPSHOT, just enter the command SNAPSHOT at the DOS
  27. prompt, and you'll see messages similar to the following if SNAPSHOT loads
  28. successfully.
  29.  
  30.  
  31.         C> SNAPSHOT
  32.  
  33.         SNAPSHOT  Version 1.02
  34.         Copyright (c) 1991 Ted Gruber Software.  All Rights Reserved.
  35.  
  36.         Press <alt>-<left shift> to activate.
  37.  
  38.  
  39.      After SNAPSHOT loads, control returns to the DOS prompt.  At this point,
  40. you can use any method whatsoever to display a graphic image and then press
  41. the Alt and left shift keys at the same time to capture the image.  You don't
  42. need to load SNAPSHOT for each image capture, just once per system boot.
  43. SNAPSHOT uses about 14,000 bytes of conventional memory once loaded.
  44.  
  45.      To illustrate the use of SNAPSHOT, suppose you have drawn and saved an
  46. image with a commercial paint program, and you want to incorporate this image
  47. into a Fastgraph application.  Once you load SNAPSHOT, start the paint
  48. program and retrieve your image.  Then press the Alt and left shift keys
  49. simultaneously and wait for the success tone (three quick medium-pitched
  50. sounds).  Finally, exit the paint program to return to the DOS prompt.
  51.  
  52.      The sequence described in the preceding paragraph will store the
  53. captured image in Fastgraph's standard pixel run format, in a file named
  54. SNAPSHOT.nnn in the current directory.  The file type nnn will be the first
  55. sequence of digits that does not result in a duplicate file name.  That is,
  56. if there are no captured image files in the current directory, SNAPSHOT will
  57. use the file name SNAPSHOT.000.  The next time you capture an image, SNAPSHOT
  58. will store it in SNAPSHOT.001, then SNAPSHOT.002, and so forth.  If you
  59. rename or delete one of these files, SNAPSHOT will again use that file name.
  60. For example, if you delete SNAPSHOT.000 but keep SNAPSHOT.001, SNAPSHOT will
  61. store the next image it captures in SNAPSHOT.000.
  62.  
  63.      If SNAPSHOT is unable to capture the image, it will produce its error
  64. tone (a single low-pitched sound).  The most common cause of this is trying
  65. to capture an image from a text video mode, but it also will occur if there
  66. is not enough disk space or if all 1,000 image file names are already being
  67. used.
  68.                                         Appendix A:  Fastgraph Utilities   311
  69.  
  70.  
  71. CLIP Utility
  72.  
  73.      The SNAPSHOT utility described in the previous section captures the
  74. entire screen.  While this might be desirable in some cases, other times
  75. you'll just need a portion of the screen.  CLIP is an interactive utility
  76. that you can use to reduce the size of any image stored in Fastgraph's
  77. standard or packed pixel run format.  The syntax of the command for invoking
  78. the CLIP utility from the DOS prompt is
  79.  
  80.                      CLIP input_file output_file options
  81.  
  82. where input_file is the name of the original image file, and output_file is
  83. the name of the new image file.  CLIP does not modify the input_file in any
  84. way, but it will overwrite the output_file if an identically named file
  85. exists in the current directory.  The options list specifies one or more
  86. optional switches as shown below.
  87.  
  88. option    meaning
  89.  
  90. /M:mode   Specifies the video mode number in which to display the image.  The
  91.           mode value must be an integer between 0 and 29.  If that video mode
  92.           is a text mode, an unsupported graphics mode, or an unavailable
  93.           graphics mode, CLIP displays an error message stating this.  If the
  94.           /M switch is not present, CLIP uses the first available video mode
  95.           from the list 18, 16, 15, 19, 13, 9, 4, 12.
  96.  
  97. /P        Indicates the input_file is in Fastgraph's packed pixel run format.
  98.           If the /P switch is not present, CLIP assumes it is in standard
  99.           pixel run format.  The output_file will be in the same format as
  100.           the input_file.
  101.  
  102. /W:width  Specifies the image width in pixels.  The width value must be an
  103.           integer between 1 and the horizontal resolution of the selected
  104.           video mode.  If the /W switch is not present, CLIP uses the
  105.           horizontal resolution of the selected video mode.
  106.  
  107. For example, if you wanted to create the image file PARTIAL.PPR from the
  108. packed pixel run file SCREEN.PPR, and use the native 320 by 200 EGA graphics
  109. video mode (mode 13), you would start CLIP with the following command.
  110.  
  111.                      CLIP PARTIAL.PPR SCREEN.PPR /P /M:13
  112.  
  113. Because no /W switch appears in the above command and the horizontal
  114. resolution of mode 13 is 320 pixels, CLIP assumes the image width is 320
  115. pixels.
  116.  
  117.      When CLIP displays the image and the plus-shaped cursor, you are ready
  118. to define one corner of the clipping region (that part of the image used to
  119. create the output_file).  To do this, use the directional keys on the numeric
  120. keypad to move the cursor to the desired position, then press the Enter key.
  121. You are then ready to define the clipping region's opposite corner.  Again,
  122. use the directional keys to move the cursor to the desired position.  When
  123. defining the second corner, however, CLIP uses a rectangular box instead of
  124. the plus-shaped cursor to simplify marking the clipping region's boundaries.
  125. After you press Enter to define the second corner, CLIP creates the
  126. 312   Fastgraph User's Guide
  127.  
  128.  
  129. output_file and displays the resulting image width and the number of pixel
  130. runs the image contains.
  131.  
  132.      CLIP includes some features that may help you define the clipping
  133. region.  You can change the distance the cursor moves in response to the
  134. directional keys, display the current (x,y) pixel coordinates of the cursor,
  135. and change the cursor color.  The following table explains the keystrokes
  136. that CLIP recognizes when you are defining the clipping region.
  137.  
  138. key       meaning
  139.  
  140. F1        Displays the (x,y) coordinate bar at the top of the screen.  If the
  141.           coordinate bar is already on, F1 removes it.
  142. F2        Displays the (x,y) coordinate bar at the bottom of the screen.  If
  143.           the coordinate bar is already on, F2 removes it.
  144. F3        Changes the cursor or box color from white to black, or from black
  145.           to white.
  146. F4        Displays a summary of the keys CLIP recognizes when defining the
  147.           clipping region.
  148. KP1       Moves the cursor one unit down and to the left.
  149. KP2       Moves the cursor one unit down.
  150. KP3       Moves the cursor one unit down and to the right.
  151. KP4       Moves the cursor one unit to the left.
  152. KP6       Moves the cursor one unit to the right.
  153. KP7       Moves the cursor one unit up and to the left.
  154. KP8       Moves the cursor one unit up.
  155. KP9       Moves the cursor one unit up and to the right.
  156. +         Increases the unit of cursor movement by one pixel.  The default
  157.           cursor movement is one pixel.
  158. -         Decreases the unit of cursor movement by one pixel.
  159. Enter     Defines a corner of the clipping region at the cursor position.
  160. Esc       Exits to DOS without creating the output_file.  CLIP will first
  161.           issue an "Exit to DOS?" prompt in case you pressed the Esc key
  162.           accidentally.
  163.  
  164.  
  165. CONVERT Utility
  166.  
  167.      The CONVERT utility lets you translate files between Fastgraph's SPR and
  168. PPR image file formats.  The syntax of the command for invoking CONVERT from
  169. the DOS prompt is
  170.  
  171.                         CONVERT input_file output_file
  172.  
  173. where input_file is the name of the original image file, and output_file is
  174. the name of the new translated image file.  CONVERT does not modify the
  175. input_file in any way, but it will overwrite the output_file if an
  176. identically named file exists in the current directory.
  177.  
  178.      By default, the file type of the input_file and output_file determine
  179. the image format of that file.  If the file type is .PPR, CONVERT assumes the
  180. image is in Fastgraph's packed pixel run format.  If the file type is .SPR,
  181. CONVERT assumes it is in the Fastgraph's standard pixel run format.  If your
  182. image files use other file types, you can explicitly specify the file's image
  183. format by appending one of the switches /PPR or /SPR to the file name.  The
  184.                                         Appendix A:  Fastgraph Utilities   313
  185.  
  186.  
  187. input_file and output_file must not both specify the same image format
  188. (CONVERT will display an error message if this is so).
  189.  
  190.      The following command will translate the standard pixel run file
  191. PICTURE.SPR to packed format.  The packed image will be stored in the file
  192. PICTURE.IMG, so we must append the switch /PPR to tell CONVERT that it will
  193. be a packed file.
  194.  
  195.                      CONVERT PICTURE.SPR PICTURE.IMG/PPR
  196.  
  197.  
  198. EDITSPR Utility
  199.  
  200.      The EDITSPR utility changes all pixel runs of one color to another color
  201. in an image file stored in Fastgraph's standard pixel run (SPR) format.  The
  202. syntax of the command for invoking the EDITSPR utility from the DOS command
  203. prompt is
  204.  
  205.                         EDITSPR input_file output_file
  206.  
  207. where input_file is the name of the original image file, and output_file is
  208. the name of the new image file.  EDITSPR does not modify the input_file in
  209. any way, but it will overwrite the output_file if an identically named file
  210. exists in the current directory.
  211.  
  212.      After it reads the pixel runs from the input_file, EDITSPR will perform
  213. the requested color changes.  It does this iteratively by asking for an old
  214. color value followed by a new color value (each value must be between 0 and
  215. 255).  EDITSPR then finds the pixel runs of the old color value and changes
  216. them to the new color value.  Following this, EDITSPR displays a message
  217. stating how many pixel runs it changed.  This process repeats until you enter
  218. a negative number for either color value.
  219.  
  220.      EDITSPR will next combine adjacent pixel runs of like colors.  For
  221. example, suppose the original image file contained a color 1 pixel run of
  222. length 50, followed by a color 2 pixel run of length 20, followed by another
  223. color 1 pixel run of length 10.  If you changed all color 2 pixel runs to
  224. color 1, EDITSPR will combine these three pixel runs into a single run of
  225. length 80.
  226.  
  227.      Finally, EDITSPR will close the output_file.
  228.  
  229.  
  230. GrabRGB Utility
  231.  
  232.      The GrabRGB utility is a terminate and stay resident program (TSR) to
  233. capture the current red, green, and blue color components of video DAC
  234. registers in 256-color graphics modes.  You can use GrabRGB together with
  235. Fastgraph's SNAPSHOT utility to preserve the original colors of a captured
  236. image.
  237.  
  238.      To load GrabRGB, just enter the command GRABRGB at the DOS prompt.
  239. After GrabRGB loads, control returns to the DOS prompt.  At this point, you
  240. can use any method whatsoever to display a 256-color graphic image and then
  241. press the Alt and right shift keys at the same time to capture the current
  242. DAC values.  You don't need to load GrabRGB for each image, just once per
  243. 314   Fastgraph User's Guide
  244.  
  245. system boot.  GrabRGB uses about 15,000 bytes of conventional memory once
  246. loaded.
  247.  
  248.      To illustrate the use of GrabRGB, suppose you have drawn and saved a
  249. 256-color image with a commercial paint program, and you want to incorporate
  250. this image into a Fastgraph application.  Once you load SNAPSHOT and GrabRGB,
  251. start the paint program and retrieve your image.  Then press the Alt and left
  252. shift keys to capture the image with SNAPSHOT.  After SNAPSHOT's success tone
  253. (three quick medium-pitched sounds), press Alt and right shift to capture the
  254. RGB components of each DAC register with GrabRGB, and wait for GrabRGB's
  255. success tone.  Finally, exit the paint program and return to the DOS prompt.
  256.  
  257.      The sequence described in the preceding paragraph will write the RGB
  258. color components for each DAC register to a file named GRABRGB.nnn in the
  259. current directory.  The file type nnn will be the first sequence of digits
  260. that does not result in a duplicate file name.  That is, if there are no
  261. GrabRGB output files in the current directory, GrabRGB will use the file name
  262. GRABRGB.000.  The next time you use GrabRGB, it will store the RGB
  263. information in GRABRGB.001, then GRABRGB.002, and so forth.  If you rename or
  264. delete one of these files, GrabRGB will again use that file name.  For
  265. example, if you delete GRABRGB.000 but keep GRABRGB.001, GrabRGB will next
  266. use the file name GRABRGB.000.
  267.  
  268.      If GrabRGB is unable to obtain the RGB components of each DAC register,
  269. it will produce its error tone (a single low-pitched sound).  The most common
  270. cause of this is trying to capture an image from a text video mode, or from a
  271. graphics video mode with fewer than 256 colors.  It also will occur if there
  272. is not enough disk space or if all 1,000 output file names are already being
  273. used.
  274.  
  275.      Each line in the output file created by GrabRGB is of the form
  276.  
  277.                                 nnn,rr,gg,bb,
  278.  
  279. where nnn is a DAC register index (between 0 and 255), rr is the red
  280. component of that DAC register, gg is the green component, and bb is the blue
  281. component.  Each color component is between 0 and 63.  You can edit and
  282. reformat these lines as necessary for inclusion in a C initializer list, a
  283. BASIC or FORTRAN data statement, or a Pascal array-type constant list.  Such
  284. an array of RGB components, but without the nnn indices, is in the format
  285. expected by fg_setdacs.
  286.  
  287.      By default, GrabRGB captures information for all 256 DAC registers.  If
  288. you want to consider only the DAC registers with color components different
  289. from their initial values, just include the /D option when you load GrabRGB
  290. (that is, use the command GRABRGB /D).  If you specify the /D option and all
  291. 256 DACs use their default values, the output file will contain a message
  292. stating this.
  293.  
  294.  
  295. HERCFIX Utility
  296.  
  297.      The HERCFIX utility allows you to use SNAPSHOT (and possibly other TSRs)
  298. with programs that do not update the BIOS data area when establishing the 720
  299. by 348 Hercules graphics mode.  If you use SNAPSHOT with such a program, it
  300. will think the monochrome text mode (video mode 7) is active and will produce
  301. its low-pitched error tone when activated.
  302.                                         Appendix A:  Fastgraph Utilities   315
  303.  
  304.  
  305.      If this occurs, use HERCFIX to load the application from which you are
  306. trying to capture the image.  To do this, enter
  307.  
  308.                                HERCFIX command
  309.  
  310. at the DOS prompt, where command is the command that starts the application.
  311. For example, suppose you use the command PAINTER /H to run a commercial paint
  312. program in Hercules graphics mode.  To load the paint program with HERCFIX,
  313. you would enter the command HERCFIX PAINTER /H.
  314.  
  315.  
  316. PCXHEAD Utility
  317.  
  318.      The PCXHEAD utility displays the most important information from the
  319. header of a PCX file.  This consists of the PCX version number, the number of
  320. bits per pixel, the number of bit planes, the scan line width, and the image
  321. dimensions and screen position.  It also proposes the optimal video mode for
  322. displaying the PCX file.  By optimal, we mean the compatible video mode
  323. having the lowest resolution larger than or equal to the image dimensions.
  324. For 256-color PCX images, PCXHEAD displays the extended color palette if one
  325. is present.
  326.  
  327.      The syntax of the command for invoking the PCXHEAD utility from the DOS
  328. command prompt is
  329.  
  330.                                PCXHEAD pcx_file
  331.  
  332. where pcx_file is the name of the PCX file to examine.  PCXHEAD does not
  333. modify the pcx_file in any way.  If the PCX file includes an extended color
  334. palette, you may prefer to direct the PCXHEAD output to a file using the DOS
  335. redirection operator (>).
  336. 316   Fastgraph User's Guide
  337.  
  338. Appendix B
  339.  
  340.  
  341.  
  342.  
  343.  
  344. Using Fastgraph
  345. from Assembly Language
  346.  
  347. 318   Fastgraph User's Guide
  348.  
  349.  
  350.      Fastgraph uses the same naming and calling conventions as Microsoft C
  351. and Turbo C.  The details of these conventions that are important to assembly
  352. language programming are summarized below.  If you are calling Fastgraph
  353. routines from an assembly language program, the program must follow these
  354. conventions.
  355.  
  356.        All arrays and pointers are passed by reference
  357.        All other items are passed by value
  358.        Arguments are pushed onto the stack in reverse order
  359.        16-bit function values are returned in the AX register
  360.        32-bit function values are returned in the DX:AX register pair
  361.        Fastgraph routine names are prefixed with an underscore
  362.  
  363. The small and medium model Fastgraph libraries pass arrays and pointers by
  364. near reference, while the large model library does so by far reference.  This
  365. is consistent with the run-time libraries for the supported compilers.
  366.  
  367.      All Fastgraph routines preserve the BP, DS, DI, and SI registers.  The
  368. contents of any other registers are unknown upon return from a Fastgraph
  369. routine (except for the AX register, which will either contain zero or the
  370. routine's return value).
  371.  
  372.      The following DOS commands show how to assemble a program (using the
  373. Microsoft Macro Assembler) and then link it with Fastgraph.  In all cases,
  374. we'll assume the file EXAMPLE.ASM contains the source code for the program.
  375. The resulting executable file will be called EXAMPLE.EXE.
  376.  
  377.                               small memory model
  378.  
  379.                     MASM EXAMPLE.ASM;
  380.                     LINK /CP:4096 /E EXAMPLE,,NUL.MAP,FGS
  381.  
  382.  
  383.                              medium memory model
  384.  
  385.                     MASM EXAMPLE.ASM;
  386.                     LINK /CP:4096 /E EXAMPLE,,NUL.MAP,FGM
  387.  
  388.  
  389.                               large memory model
  390.  
  391.                     MASM EXAMPLE.ASM;
  392.                     LINK /CP:4096 /E EXAMPLE,,NUL.MAP,FGL
  393.  
  394.  
  395.      Example B-1 calls the fg_getmode, fg_setmode, fg_reset, and fg_version
  396. routines from an assembly language program.  The fg_getmode routine returns
  397. its function value in the AX register.  The fg_setmode routine has a single
  398. argument, while fg_reset has no arguments.  The fg_version routine has two
  399. arguments, both passed by reference.  Notice how they are pushed on the stack
  400. in reverse order.  This example would work with either the medium or large
  401. memory model Fastgraph libraries.  To make it work with the small model
  402. library, all you would need to do is change the word "far" to "near" in the
  403. EXTRN declarations, and change the name of the code segment from "main_TEXT"
  404. to "_TEXT".
  405.  
  406.                      Appendix B:  Using Fastgraph from Assembly Language   319
  407.  
  408.  
  409.                                  Example B-1.
  410.  
  411.                 EXTRN   _fg_getmode:far  ; Fastgraph's GETMODE routine
  412.                 EXTRN   _fg_reset:far    ; Fastgraph's RESET routine
  413.                 EXTRN   _fg_setmode:far  ; Fastgraph's SETMODE routine
  414.                 EXTRN   _fg_version:far  ; Fastgraph's VERSION routine
  415.  
  416.       stackseg  SEGMENT stack         ; suppress the linker's
  417.       stackseg  ENDS                  ; "no stack segment" error message
  418.  
  419.       _DATA     SEGMENT word public 'DATA'
  420.  
  421.       major     dw      ?             ; major version number
  422.       minor     dw      ?             ; minor version number
  423.       old_mode  dw      ?             ; original video mode
  424.  
  425.       _DATA     ENDS
  426.  
  427.       dgroup    GROUP   _DATA
  428.                 ASSUME  cs:main_TEXT,ds:dgroup
  429.  
  430.       main_TEXT SEGMENT byte public 'CODE'
  431.  
  432.       start:    mov     ax,_DATA      ; load segment location
  433.                 mov     ds,ax         ; into DS register
  434.  
  435.                 call    _fg_getmode   ; AX = current video mode
  436.                 mov     old_mode,ax   ; save it
  437.  
  438.                 mov     ax,4          ; use video mode 4
  439.                 push    ax            ; pass argument to SETMODE
  440.                 call    _fg_setmode   ; establish CGA four-color mode
  441.                 add     sp,2          ; remove SETMODE argument
  442.  
  443.                 push    old_mode      ; pass argument to SETMODE
  444.                 call    _fg_setmode   ; restore original video mode
  445.                 add     sp,2          ; remove SETMODE argument
  446.  
  447.                 call    _fg_reset     ; restore screen attributes
  448.  
  449.                 lea     ax,minor      ; get address of minor variable
  450.                 push    ax            ; pass argument #2 to VERSION
  451.                 lea     ax,major      ; get address of major variable
  452.                 push    ax            ; pass argument #1 to VERSION
  453.                 call    _fg_version   ; get the Fastgraph version number
  454.                 add     sp,4          ; remove VERSION arguments
  455.  
  456.                 mov     ah,76         ; function 76: terminate process
  457.                 xor     al,al         ; errorlevel 0
  458.                 int     21h           ; exit to DOS
  459.  
  460.       main_TEXT ENDS
  461.                 END     start
  462.  
  463. 320   Fastgraph User's Guide
  464.  
  465. Appendix C
  466.  
  467.  
  468.  
  469.  
  470.  
  471. Interrupts and Fastgraph
  472.  
  473. 322   Fastgraph User's Guide
  474.  
  475.  
  476. Interrupts Used by Fastgraph
  477.  
  478.      DOS maintains an interrupt vector table that contains the addresses of
  479. 256 interrupt handlers, or routines, that perform various functions.  The
  480. handlers are usually referenced by their hexadecimal interrupt number,
  481. between 00 and FF.  Of these, only interrupts 60 through 66 and F1 through FF
  482. are not used by DOS, the ROM BIOS, or other software and are thus available
  483. for user applications.
  484.  
  485.      Certain Fastgraph routines use some of the available interrupts.
  486. Namely, the fg_music routine uses interrupt 60, the asynchronous sound
  487. routines (fg_musicb, fg_sounds, and fg_voices) use interrupts 60 and 61, and
  488. all Fastgraph/Light routines use interrupt 62.  If your program defines its
  489. own interrupt handlers, it must not use any of the interrupts reserved for
  490. Fastgraph (unless, of course, it doesn't use any of the Fastgraph routines
  491. that would create a conflict).
  492.  
  493.  
  494. Extending the Time-of-Day Interrupt
  495.  
  496.      As mentioned in Chapter 16, the BIOS time-of-day clock is incremented by
  497. an interrupt handler.  The routine that does this is interrupt 08, a hardware
  498. interrupt automatically activated 18.2 times per second.  After incrementing
  499. the clock, interrupt 08 invokes interrupt 1C, which by default references a
  500. "do-nothing" interrupt handler.  While changing interrupt 08 can be tricky,
  501. it is fairly straightforward to define our own handler for interrupt 1C.
  502. This handler also will be executed automatically 18.2 times per second.
  503. Example C-1 illustrates how to do this.
  504.  
  505.      When we discussed joysticks in Chapter 14, we said there were two ways
  506. to monitor joystick button status.  One is to intersperse calls to the
  507. fg_button routine at strategic places in your program and then take necessary
  508. action depending on the button status.  However, the problem with this scheme
  509. is the chance of missing a button press -- if you press the joystick button
  510. and then release it between calls to fg_button, the program will not detect
  511. the joystick activity.  A preferable method is to call fg_button from a
  512. handler for interrupt 1C, which essentially provides continuous monitoring of
  513. the joystick buttons.  When we need the button status within our program, all
  514. we need to do is examine a global variable.
  515.  
  516.      Example C-1 consists of a main program (written in C) and an assembly
  517. language subroutine named int1C (suitable for the medium memory model).  The
  518. main program calls int1C to define a handler for interrupt 1C.  In response
  519. to any keystroke (except Escape), the program displays the button press
  520. information for each joystick since the previous keystroke (refer to the
  521. discussion of the fg_button routine for the meanings of the status values).
  522. When you press the Escape key, the program exits to DOS, but not before
  523. calling int1C to restore the original interrupt 1C handler.
  524.  
  525.                          Example C-1 (main program).
  526.  
  527.                #include <fastgraf.h>
  528.                #include <stdio.h>
  529.                void main(void);
  530.  
  531.                #define ESC 27
  532.                                    Appendix C:  Interrupts and Fastgraph   323
  533.  
  534.  
  535.                int status1, status2;
  536.  
  537.                void main()
  538.                {
  539.                   unsigned char key, aux;
  540.  
  541.                   int1C(1);
  542.  
  543.                   status1 = 0;
  544.                   status2 = 0;
  545.  
  546.                   do {
  547.                      printf("\n");
  548.                      printf("Joystick 1 status: %d\n",status1);
  549.                      printf("Joystick 2 status: %d\n",status2);
  550.                      status1 = 0;
  551.                      status2 = 0;
  552.                      fg_getkey(&key,&aux);
  553.                      }
  554.                   while (key != ESC);
  555.  
  556.                   int1C(0);
  557.                }
  558.  
  559.  
  560.      We'll now examine the int1C assembly language subroutine.  It actually
  561. consists of three parts:  a portion to enable our interrupt handler, our
  562. handler itself, and a portion to disable the handler.  When we call int1C
  563. with a nonzero argument, it saves the original data segment (so we can access
  564. the global variables within the handler), saves the original handler's
  565. address (called the vector) for interrupt 1C, and then enables our handler,
  566. which takes the form of a far procedure.
  567.  
  568.      The handler routine then begins to be activated at 18.2 times per
  569. second.  After saving all the important registers, the handler calls the
  570. Fastgraph routine fg_button twice, once for each joystick.  The return values
  571. are logically ORed with the status1 and status2 C global variables to update
  572. the button status information.  Finally, the handler restores the original
  573. registers and returns control to the point of the interrupt.
  574.  
  575.      Before the main program exits, it calls int1C with a zero argument to
  576. restore the original handler for interrupt 1C.  No provision is made in the
  577. program to check if we had previously defined our own handler (and hence
  578. saved the original interrupt 1C vector), but this could be added with little
  579. difficulty.
  580.  
  581.                  Example C-1 (assembly language subroutine).
  582.  
  583.  
  584.               EXTRN   _status1:word ; C global variable for button 1 status
  585.  
  586.               EXTRN   _status2:word ; C global variable for button 2 status
  587.  
  588.               EXTRN   _fg_button:far ; Fastgraph routine
  589.  
  590. 324   Fastgraph User's Guide
  591.  
  592.  
  593.  
  594.    int1C_TEXT SEGMENT byte public 'CODE'
  595.  
  596.               ASSUME  cs:int1C_TEXT
  597.  
  598.  
  599.  
  600.    int1C_CS   dw      ?             ; holds original INT 1C segment address
  601.  
  602.    int1C_IP   dw      ?             ; holds original INT 1C offset
  603.  
  604.    orig_DS    dw      ?             ; holds original data segment
  605.  
  606.  
  607.  
  608.    _int1C     PROC    far
  609.  
  610.               PUBLIC  _int1C
  611.  
  612.  
  613.  
  614.               push    bp            ; save caller's BP register
  615.  
  616.               mov     bp,sp         ; make BP point to argument list
  617.  
  618.               push    si            ; save caller's SI register
  619.  
  620.               push    di            ; save caller's DI register
  621.  
  622.  
  623.  
  624.               mov     dx,[bp+6]     ; get the flag parameter
  625.  
  626.               or      dx,dx         ; replace the old interrupt handler?
  627.  
  628.               jz      replace       ; yes, branch to that processing
  629.  
  630.  
  631.  
  632.    ; define a new handler for INT 1C
  633.  
  634.  
  635.  
  636.    define:    mov     ax,ds         ; put current data segment in AX
  637.  
  638.               mov     cs:orig_DS,ax ; save it in the control information area
  639.  
  640.  
  641.  
  642.               mov     al,1Ch        ; interrupt vector to save
  643.  
  644.               mov     ah,53         ; function 53: get interrupt vector
  645.  
  646.               int     21h           ; get the interrupt vector
  647.  
  648.                                    Appendix C:  Interrupts and Fastgraph   325
  649.  
  650.  
  651.               mov     cs:int1C_CS,es; save the segment
  652.  
  653.               mov     cs:int1C_IP,bx; save the offset
  654.  
  655.  
  656.  
  657.               push    ds            ; save our DS register
  658.  
  659.               mov     dx,offset handler ; get offset of interrupt handler
  660.  
  661.               mov     ax,seg handler; get segment of interrupt handler
  662.  
  663.               mov     ds,ax         ; put it in DS
  664.  
  665.               mov     al,1Ch        ; interrupt vector to change
  666.  
  667.               mov     ah,37         ; function 37: set interrupt vector
  668.  
  669.               int     21h           ; change the INT 1C vector to our handler
  670.  
  671.               pop     ds            ; restore our DS register
  672.  
  673.  
  674.  
  675.               jmp     short return  ; return to the caller
  676.  
  677.  
  678.  
  679.    ; replace the original handler for INT 1C
  680.  
  681.  
  682.  
  683.    replace:   push    ds            ; save our DS register
  684.  
  685.               mov     dx,cs:int1C_IP; put original INT 1C offset in DX
  686.  
  687.               mov     ds,cs:int1C_CS; put original INT 1C segment in DS
  688.  
  689.               mov     ah,37         ; function 37: set interrupt vector
  690.  
  691.               mov     al,1Ch        ; interrupt vector 1C
  692.  
  693.               int     21h           ; restore original INT 1C vector
  694.  
  695.               pop     ds            ; restore our DS register
  696.  
  697.  
  698.  
  699.    return:    xor     ax,ax         ; in case int1C was called as a function
  700.  
  701.               pop     di            ; restore our DI register
  702.  
  703.               pop     si            ; restore our SI register
  704.  
  705.               pop     bp            ; restore our BP register
  706.  
  707. 326   Fastgraph User's Guide
  708.  
  709.  
  710.               ret
  711.  
  712.  
  713.  
  714.    _int1C     ENDP
  715.  
  716.  
  717.  
  718.  
  719.  
  720.    handler    PROC    far           ; interrupt handler that replaces INT 1C
  721.  
  722.  
  723.  
  724.               cli                   ; disable interrupts while handler active
  725.  
  726.               push    ax            ; save registers that may be altered
  727.  
  728.               push    bx
  729.  
  730.               push    cx
  731.  
  732.               push    dx
  733.  
  734.               push    di
  735.  
  736.               push    si
  737.  
  738.               push    ds
  739.  
  740.               push    es
  741.  
  742.  
  743.  
  744.               mov     ds,cs:orig_DS ; retrieve the original data segment
  745.  
  746.  
  747.  
  748.               mov     ax,1          ; use joystick 1
  749.  
  750.               push    ax            ; pass joystick number to button routine
  751.  
  752.               call    _fg_button    ; AX = button status for joystick 1
  753.  
  754.               add     sp,2          ; remove the argument
  755.  
  756.               or      _status1,ax   ; update status variable for joystick 1
  757.  
  758.  
  759.  
  760.               mov     ax,2          ; use joystick 2
  761.  
  762.               push    ax            ; pass joystick number to button routine
  763.  
  764.               call    _fg_button    ; AX = button status for joystick 2
  765.  
  766.                                    Appendix C:  Interrupts and Fastgraph   327
  767.  
  768.  
  769.               add     sp,2          ; remove the argument
  770.  
  771.               or      _status2,ax   ; update status variable for joystick 2
  772.  
  773.  
  774.  
  775.               pop     es            ; restore altered registers
  776.  
  777.               pop     ds
  778.  
  779.               pop     si
  780.  
  781.               pop     di
  782.  
  783.               pop     dx
  784.  
  785.               pop     cx
  786.  
  787.               pop     bx
  788.  
  789.               pop     ax
  790.  
  791.               iret                  ; return from the interrupt routine
  792.  
  793.  
  794.  
  795.    handler    ENDP
  796.  
  797.  
  798.  
  799.    int1C_TEXT ENDS
  800.  
  801.               END
  802.  
  803.  
  804.  
  805.  
  806.      The example just presented is not meant to be a tutorial on interrupts;
  807. there are many good references on DOS that explain them in detail.  However,
  808. an example specific to Fastgraph should be helpful.
  809. 328   Fastgraph User's Guide
  810.  
  811. Appendix D
  812.  
  813.  
  814.  
  815.  
  816.  
  817. Contents of the
  818. Compiler-Specific Libraries
  819.  
  820. 330   Fastgraph User's Guide
  821.  
  822.  
  823.      Each supported Fastgraph compiler except QuickBASIC and Visual Basic for
  824. DOS have a compiler-specific Fastgraph library (also called the extended
  825. Fastgraph library) that contains the following routines:
  826.  
  827.           fg_boxw        fg_drawxw      fg_panw        fg_setsize
  828.           fg_boxxw       fg_drectw      fg_pointw      fg_setsizew
  829.           fg_circlew     fg_ellipsew    fg_pointxw     fg_setworld
  830.           fg_circlefw    fg_ellipsfw    fg_polygonw    fg_swchar
  831.           fg_clprectw    fg_floodw      fg_rectw       fg_swlength
  832.           fg_dashrw      fg_getworld    fg_restorew    fg_swtext
  833.           fg_dashw       fg_initw       fg_savew       fg_xscreen
  834.           fg_drawrw      fg_moverw      fg_setangle    fg_xworld
  835.           fg_drawrxw     fg_movew       fg_setclipw    fg_yscreen
  836.           fg_draww       fg_paintw      fg_setratio    fg_yworld
  837.  
  838. These routines use the world space coordinate system, either directly or
  839. internally.  Note that none of them are included in Fastgraph/Light.
  840.  
  841.      As mentioned in Chapter 1, if your program uses any of these routines,
  842. you must link it with the standard Fastgraph library and the corresponding
  843. extended Fastgraph library.
  844. Appendix E
  845.  
  846.  
  847.  
  848.  
  849.  
  850. Contents of the
  851. Pascal Unit Files
  852.  
  853. 332   Fastgraph User's Guide
  854.  
  855.  
  856.      Borland Pascal and Turbo Pascal restrict the total size of all code
  857. segments in a unit file 65,520 bytes.  Because the size of Fastgraph's code
  858. exceeds this amount, the Fastgraph functions are split among several unit
  859. files.  This appendix lists the contents of each Pascal unit file.
  860.  
  861. Fastgraph routines in FGBITMAP.TPU
  862.  
  863.           fg_clipmask       fg_flipmask      fg_imagebuf       fg_revimage
  864.           fg_clpimage       fg_flpimage      fg_imagesiz       fg_revmask
  865.           fg_drawmask       fg_getblock      fg_putblock
  866.           fg_drwimage       fg_getimage      fg_putimage
  867.  
  868. Fastgraph routines in FGGIF.TPU
  869.  
  870.           fg_makegif        fg_showgif
  871.  
  872. Fastgraph routines in FGMISC.TPU
  873.  
  874.           fg_button         fg_intkey        fg_mousepos       fg_setcaps
  875.           fg_capslock       fg_kbinit        fg_mouseptr       fg_setnum
  876.           fg_cursor         fg_kbtest        fg_mousespd       fg_sound
  877.           fg_getclock       fg_measure       fg_mousevis       fg_sounds
  878.           fg_getkey         fg_memavail      fg_music          fg_suspend
  879.           fg_getxjoy        fg_mousebut      fg_musicb         fg_voice
  880.           fg_getyjoy        fg_mousecur      fg_numlock        fg_voices
  881.           fg_hush           fg_mousefin      fg_playing        fg_waitfor
  882.           fg_hushnext       fg_mouseini      fg_quiet          fg_waitkey
  883.           fg_initjoy        fg_mouselim      fg_resume
  884.           fg_intjoy         fg_mousemov      fg_scrlock
  885.  
  886. Fastgraph routines in FGPCX.TPU
  887.  
  888.           fg_makepcx        fg_pcxhead       fg_pcxmode        fg_showpcx
  889.  
  890. Fastgraph routines in FGPR.TPU
  891.  
  892.           fg_dispfile       fg_displayp      fg_makespr        fg_showspr
  893.           fg_display        fg_makeppr       fg_showppr
  894.  
  895. Fastgraph routines in FGSVGA.TPU
  896.  
  897.           fg_defpages       fg_svgainit      fg_svgaver
  898.           fg_memory         fg_svgastat
  899.  
  900. Pascal versions of the routines listed in Appendix D are in the unit file
  901. FGWORLD.TPU.  All other Fastgraph routines are in the FGMAIN.TPU unit file.
  902.  
  903. As mentioned in Chapter 1, Pascal programs must include a uses statement
  904. listing all units referenced in the program.  The FGMAIN unit is always
  905. required.  Other unit files are needed when you call the Fastgraph functions
  906. they contain.
  907. Appendix F
  908.  
  909.  
  910.  
  911.  
  912.  
  913. Integrating Fastgraph With
  914. Other Graphics Software
  915.  
  916. 334   Fastgraph User's Guide
  917.  
  918.  
  919.      Sometimes you may want to use Fastgraph with other graphics software,
  920. such as when converting an existing graphics application to Fastgraph.  This
  921. appendix may clarify some points about doing this.
  922.  
  923.      First, let the other graphics software establish the video mode, then
  924. initialize Fastgraph for that mode by calling fg_setmode(-1).  Passing -1 to
  925. fg_setmode does not physically change video modes but merely initializes
  926. Fastgraph's internal parameters for the current video mode.
  927.  
  928.      Second, if you're using the EGA/VGA/SVGA 16-color graphics modes (modes
  929. 13 to 18, 28, and 29), you'll probably need to explicitly define the value of
  930. the EGA/VGA Enable Set/Reset register (port address 03CE hex, index 01).
  931. Fastgraph's functions expect this register to have the value 0F hex; this
  932. allows Fastgraph take advantage of a more efficient variant available in
  933. EGA/VGA write mode 0.  The default value for the Enable Set/Reset register is
  934. zero.
  935.  
  936.      After you've called fg_setmode(-1) and need to call a third party
  937. graphics function, set the Enable Set/Reset register to its default value by
  938. including the following statement just before calling the third party
  939. function:
  940.  
  941. outport(0x03CE,0x0001);       Borland C++, Turbo C/C++, or Power C
  942. outpw(0x03CE,0x0001);         Microsoft C or QuickC
  943. OUT &h03CE,1 : OUT &h03CF,0   QuickBASIC or Visual Basic
  944.  
  945. Just before you call the next Fastgraph function, restore the Enable
  946. Set/Reset register value with the following statement:
  947.  
  948. outport(0x03CE,0x0F01);       Borland C++, Turbo C/C++, or Power C
  949. outpw(0x03CE,0x0F01);         Microsoft C or QuickC
  950. OUT &h03CE,1 : OUT &h03CF,15  QuickBASIC or Visual Basic
  951.  
  952.                                                                    Index   335
  953.  
  954.  
  955.                                   I n d e x
  956.  
  957. 8253-5 programmable timer chip               /M option  311
  958.           286                                /P option  311
  959. Active page  151, 152                        /W option  311
  960. Animation  238                          Clipping  98
  961.      dynamic frame  244                 Clock tick  300-302
  962.      dynamic page flipping  246         Clock tick interrupt  291, 293,
  963.      page flipping  246                           300
  964.      simple  238                        Color  68
  965.      static frame  242                  Color indices  90
  966.      static page flipping  246          Color number  70
  967.      summary  248                       Color value  70
  968.      XOR  240                           Compilation  5
  969. ANSI.SYS  45                                 BASIC PDS  11
  970. Assembly language  318                       Borland C++  8
  971. Attribute  68, 132, 133                      Borland Pascal  10
  972. Available memory  304                        Microsoft C  13
  973. Background color  68-70                      Microsoft C++  13
  974. BASIC PDS  11                                Microsoft FORTRAN  14
  975. Bit maps  190                                Power C  23
  976.      CGA  195, 196, 203                      QuickBASIC  16
  977.      EGA  198, 205                           QuickC  18
  978.      filler bits  191                        Turbo C  25
  979.      Hercules  198                           Turbo C++  25
  980.      MCGA  199                               Turbo Pascal  27
  981.      memory requirements  209                Visual Basic  20
  982.      mode-independent  190                   Visual C++  22
  983.      mode-specific  194                      Zortech C++  28
  984.      PCjr  198                          Compiler-specific Fastgraph
  985.      retrieving  207                              library  330
  986.      subscript order  191, 192,         CONVERT  312, 313
  987.           202                                /PPR switch  312
  988.      SVGA  198, 199                          /SPR switch  312
  989.      Tandy  198                         Convex shape  108
  990.      text modes  201                    Coordinate conversion  64, 137,
  991.      VGA  198, 199                                138
  992. Bit-mapped characters  145              Current color  70
  993. Bit-mapped images  190                  Cursor mask  273, 275
  994. BitBlt  222                             Dash pattern  104, 105
  995. Blit  222                               Delay units  301, 302
  996. Block transfer routines  222            Display patterns  181
  997. Borland C++  3, 8                            CGA  181, 182
  998. Borland Pascal  3, 10                        EGA  184
  999. Byte boundary  223, 224                      Hercules  184
  1000. CapsLock  262-264                            MCGA  184
  1001. CGA palettes  70                             PCjr  183
  1002. Character cells  32                          SVGA  184
  1003. Character space  60, 128                     Tandy  183
  1004. Characters                                   VGA  184
  1005.      bit-mapped  145                    Dithering  114
  1006.      hardware  129                      Dithering matrix  114
  1007.      software  139                           256-color modes  119
  1008. Circles  109                                 alignment  120
  1009. Clearing the screen  98                      CGA  115, 116
  1010. CLIP  311, 312                               EGA  118
  1011. 336   Fastgraph User's Guide
  1012.  
  1013. Dithering matrix (cont.)                     fg_dash  104, 105, 123
  1014.      Hercules  117                           fg_dashrel  104, 123
  1015.      PCjr  117                               fg_dashrw  104, 123
  1016.      SVGA  118                               fg_dashw  104, 123
  1017.      Tandy  117                              fg_defcolor  91, 94, 120
  1018.      VGA  118                                fg_dispfile  180, 181, 188,
  1019. EDITSPR  313                                      214
  1020. Ellipses  109                                fg_display  212-214, 219
  1021. EMM386.EXE  162                              fg_displayp  213, 214, 219
  1022. EMS  162                                     fg_draw  102, 123, 254
  1023. Expanded memory  162                         fg_drawmap  145, 190, 192,
  1024. Expanded Memory Manager  162                      193, 194, 195, 207,
  1025. Extended Fastgraph library  330                   208, 209, 212, 215,
  1026. Extended memory  162                              218, 219, 230, 248,
  1027. Fade  85, 86                                      275, 278
  1028. FASTGRAF.BI  6                               fg_drawmask  216-219
  1029. FASTGRAF.H  6                                fg_drawrel  102, 121, 123
  1030. Fastgraph  2                                 fg_drawrelx  102, 123
  1031. Fastgraph routines                           fg_drawrw  102, 123
  1032.      fg_allocate  154, 155,                  fg_drawrxw  102, 123
  1033.           157, 158, 160-162,                 fg_draww  102, 124
  1034.           167-169, 222, 226,                 fg_drawx  102, 124
  1035.           227, 304                           fg_drawxw  102, 124
  1036.      fg_alloccms  162, 163,                  fg_drect  114, 115, 118,
  1037.           166, 167                                119, 120, 124
  1038.      fg_allocems  162, 163, 169              fg_drectw  115, 120, 124
  1039.      fg_allocxms  162, 163, 169              fg_drwimage  145, 195-198,
  1040.      fg_automode  49, 50, 56,                     200-204, 207, 209,
  1041.           99, 109, 111, 256                       212, 215, 217, 218,
  1042.      fg_bestmode  46, 50, 51,                     219, 248, 278
  1043.           53, 57, 121, 155,                  fg_ellipse  109, 124, 242
  1044.           157, 158, 233                      fg_ellipsef  109, 124
  1045.      fg_box  112, 122                        fg_ellipsew  109, 124
  1046.      fg_boxdepth  112, 122                   fg_ellipsfw  109, 124
  1047.      fg_boxw  112, 122                       fg_erase  98, 124, 168
  1048.      fg_boxx  113, 114, 122                  fg_fadein  250, 251, 258
  1049.      fg_boxxw  113, 122                      fg_fadeout  250, 258
  1050.      fg_button  280, 281, 283,               fg_fillpage  98, 124
  1051.           322, 323                           fg_flipmask  216, 217, 219
  1052.      fg_capslock  263, 283                   fg_flood  121, 124
  1053.      fg_chgattr  132, 145                    fg_floodw  121, 124
  1054.      fg_chgtext  132, 146                    fg_flpimage  203, 204, 207,
  1055.      fg_circle  109, 123                          215, 217, 219
  1056.      fg_circlef  109, 123                    fg_fontsize  137, 146
  1057.      fg_circlefw  109, 123                   fg_freepage  155, 157, 158,
  1058.      fg_circlew  109, 123                         162, 165, 169, 304
  1059.      fg_clipmask  216, 217, 219              fg_getaddr  160, 169
  1060.      fg_clpimage  203, 204,                  fg_getattr  133, 146
  1061.           207, 215, 217, 219                 fg_getblock  233, 234
  1062.      fg_clprect  111, 123, 238,              fg_getchar  133, 146
  1063.           245, 246                           fg_getclock  301, 303
  1064.      fg_clprectw  111, 123                   fg_getcolor  69, 70, 77, 94
  1065.      fg_copypage  163, 164,                  fg_getdacs  86-88, 94, 306
  1066.           166, 168, 169, 222,                fg_getentry  166, 169
  1067.           234                                fg_gethpage  225, 234
  1068.      fg_cursor  44, 57, 94,                  fg_getimage  133, 207, 209,
  1069.           134, 226                                210, 219, 233, 248
  1070.                                                                    Index   337
  1071.  
  1072. Fastgraph routines (cont.)                   fg_mouseini  165, 267-269,
  1073.      fg_getindex  94                              271, 284
  1074.      fg_getkey  262, 265, 283                fg_mouselim  269, 270, 284
  1075.      fg_getlines  47, 57                     fg_mousemov  269, 270, 284
  1076.      fg_getmap  207-210, 219,                fg_mousepos  271, 272, 284
  1077.           230, 248                           fg_mouseptr  273, 277, 284
  1078.      fg_getmaxx  61, 62, 64,                 fg_mousespd  269, 270, 284
  1079.           111                                fg_mousevis  269, 272, 284
  1080.      fg_getmaxy  61, 62, 64,                 fg_move  101, 102, 105,
  1081.           111                                     121, 125, 135, 178,
  1082.      fg_getmode  46, 57, 318                      180, 193, 194, 208,
  1083.      fg_getpage  160, 169                         210, 214, 230, 254
  1084.      fg_getpixel  99, 124                    fg_moverel  101, 102, 125
  1085.      fg_getrgb  84-86, 94                    fg_moverw  101, 125
  1086.      fg_getvpage  160, 169                   fg_movew  101, 125
  1087.      fg_getworld  63, 64                     fg_music  289-291, 293,
  1088.      fg_getxjoy  280-283                          296, 322
  1089.      fg_getxpos  102, 124                    fg_musicb  293-296, 322
  1090.      fg_getyjoy  280-283                     fg_numlock  263, 284
  1091.      fg_getypos  102, 124                    fg_pagesize  161, 168, 170
  1092.      fg_hush  291, 293, 294,                 fg_paint  121, 125, 254
  1093.           296                                fg_paintw  121, 125
  1094.      fg_hushnext  291, 293,                  fg_palette  71-80, 82-84,
  1095.           294, 296                                89, 90, 94, 95, 201
  1096.      fg_imagebuf  186, 187                   fg_palettes  90, 95, 306
  1097.      fg_imagesiz  209, 210,                  fg_pan  255-258, 306
  1098.           219, 233                           fg_panw  255, 256, 258
  1099.      fg_initems  162, 163, 165,              fg_pattern  181, 185, 188,
  1100.           169                                     212, 213
  1101.      fg_initjoy  165, 279-281,               fg_pcxhead  174, 188
  1102.           283                                fg_pcxmode  174, 188
  1103.      fg_initw  62, 64, 101, 140              fg_playing  291, 294, 296
  1104.      fg_initxms  162, 165, 170               fg_point  99, 101, 125
  1105.      fg_inside  109, 125                     fg_pointw  99, 101, 125
  1106.      fg_intjoy  281-283                      fg_pointx  101, 125
  1107.      fg_intkey  262, 263, 265,               fg_pointxw  101, 125
  1108.           281, 283, 294, 301                 fg_polyfill  107-109, 125
  1109.      fg_justify  133-135, 146                fg_polygon  105-107, 125
  1110.      fg_kbinit  265, 266, 283                fg_polygonw  106, 125
  1111.      fg_kbtest  265, 266, 283                fg_polyline  107-109, 125
  1112.      fg_locate  129-131, 134,                fg_polyoff  107
  1113.           137, 146, 152, 159,                fg_print  133-137, 146
  1114.           210                                fg_putblock  233, 234
  1115.      fg_makegif  175, 176, 188,              fg_putimage  203, 207, 215,
  1116.           306                                     219, 233
  1117.      fg_makepcx  172, 173, 175,              fg_quiet  287-289, 296
  1118.           176, 178, 188, 306                 fg_rect  80, 84, 111, 112,
  1119.      fg_makeppr  180, 188                         114, 125, 137-139,
  1120.      fg_makespr  178, 180, 188                    152, 192, 196, 227,
  1121.      fg_maprgb  89, 94                            238, 245
  1122.      fg_measure  302, 303                    fg_rectw  111, 125, 144
  1123.      Fg_memavail  304, 307                   fg_reset  45, 46, 57, 318
  1124.      fg_memory  55, 57                       fg_resize  164, 165, 170,
  1125.      fg_mousebut  271, 272, 283                   257, 258
  1126.      fg_mousecur  273, 274, 284              fg_restore  225, 227, 228,
  1127.      fg_mousefin  268, 284                        233, 235, 245, 251
  1128.                                              fg_restorew  225, 235
  1129. 338   Fastgraph User's Guide
  1130.  
  1131. Fastgraph routines (cont.)                   fg_showspr  178, 180, 181,
  1132.      fg_resume  295, 296                          188
  1133.      fg_revimage  203, 204,                  fg_sound  286-289, 291,
  1134.           207, 215, 217, 220                      292, 296
  1135.      fg_revmask  216, 217, 220               fg_sounds  291, 292, 294,
  1136.      fg_save  225-228, 233, 235                   296, 322
  1137.      fg_savew  225, 235                      fg_stall  301-303
  1138.      fg_scrlock  263, 284                    fg_suspend  295, 296
  1139.      fg_scroll  252-254, 258                 fg_svgainit  53-55, 57
  1140.      fg_setangle  143, 146                   fg_svgaver  55, 57
  1141.      fg_setattr  68, 69, 95,                 fg_swchar  140-144, 146
  1142.           98, 129, 130, 132,                 fg_swlength  144, 147
  1143.           146, 152, 153, 156,                fg_swtext  143, 144, 147
  1144.           158                                fg_tcdefine  231-233, 235
  1145.      fg_setcaps  264, 284                    fg_tcmask  231-233, 235
  1146.      fg_setclip  98, 126, 203                fg_tcxfer  231-233, 235
  1147.      fg_setclipw  98, 126                    fg_testmode  45, 46, 51,
  1148.      fg_setcolor  44, 69-80,                      53, 55, 57, 87, 152,
  1149.           82, 83, 84, 95, 98,                     155, 205, 225, 288
  1150.           99, 118, 119, 129,                 fg_text  44, 129-134, 136,
  1151.           132, 140, 146, 152,                     137, 138, 140, 146,
  1152.           153, 156, 158, 192,                     147
  1153.           239, 240, 241, 252,                fg_transfer  228, 230-233,
  1154.           253                                     235, 244-246, 251
  1155.      fg_setdacs  86-88, 95,                  fg_version  5, 55, 318
  1156.           306, 314                           fg_voice  287-289, 291-293,
  1157.      fg_setentry  166, 168, 170                   296
  1158.      fg_setfunc  240, 305, 307               fg_voices  292-294, 297,
  1159.      fg_sethpage  225, 226,                       322
  1160.           235, 250, 252                      fg_waitfor  85, 238, 244,
  1161.      fg_setlines  47, 57                          246, 254, 256, 263,
  1162.      fg_setmode  44, 46, 53,                      270, 289, 300-303
  1163.           57, 70, 77, 83, 88,                fg_waitkey  45, 262, 265,
  1164.           90, 91, 98, 99, 101,                    284
  1165.           109, 111, 117, 118,                fg_waitvr  306, 307
  1166.           129, 130, 132, 140,                fg_where  131, 147, 159
  1167.           152, 159, 165, 166,                fg_xalpha  64, 65, 138, 147
  1168.           182, 183-185, 205,                 fg_xconvert  64, 65, 138,
  1169.           260, 267, 279, 318,                     139, 147
  1170.           334                                fg_xscreen  64, 65, 99
  1171.      fg_setnum  264, 284                     fg_xworld  64, 65, 102
  1172.      fg_setpage  152, 170, 225               fg_yalpha  64, 65, 138, 147
  1173.      fg_setratio  140, 142, 146              fg_yconvert  64, 65, 138,
  1174.      fg_setrgb  73, 76, 80, 82,                   139, 147
  1175.           83, 84, 86, 89, 94,                fg_yscreen  64, 65, 99
  1176.           95, 185, 201                       fg_yworld  64, 65, 102
  1177.      fg_setsize  140, 146               Fastgraph/Light  2
  1178.      fg_setsizew  140, 146              Fastgraph/Light Video Driver  2,
  1179.      fg_setvpage  152, 161,                       29
  1180.           170, 246, 269, 306,           FGDRIVER  29
  1181.           307                                /U option  29
  1182.      fg_setworld  62-64, 140            Filler bits  191
  1183.      fg_showgif  175, 176, 188,         Fish tank animation demo  248
  1184.           306                           Flickering  306
  1185.      fg_showpcx  172-175, 187,          Foreground color  68, 69
  1186.           188, 306                      Full page transfer  222
  1187.      fg_showppr  180, 188               Game port  279
  1188.                                                                    Index   339
  1189.  
  1190. GetMem (TP procedure)  186, 233              vertical position  280
  1191. GIF file  175                           Keyboard  260
  1192.      creating  175                           buffer  262, 301
  1193.      displaying  175                         extended codes  260
  1194. GrabRGB  181, 313, 314                       handler  264
  1195.      /D option  314                          standard codes  260
  1196.      output file format  314                 state light  264
  1197. Graphics cursor  101                    Lines
  1198. Graphics modes  32, 35, 70                   dashed  104
  1199.      256-color  83                           solid  102
  1200.      CGA  35, 70, 72                    Linking  5
  1201.      EGA  37, 76, 78, 79                Logical pages  162
  1202.      Hercules  36, 74, 75                    creating  162
  1203.      MCGA  38, 81                            releasing  162
  1204.      native EGA  37                     Masking map  201, 215-218
  1205.      native VGA  38                     Memory conflicts
  1206.      PCjr  36, 73                            logical pages  167
  1207.      SVGA  40, 83                            virtual pages  167
  1208.      Tandy  73                          Memory models  3
  1209.      Tandy 1000  36                          large  4
  1210.      VGA  38, 81, 83                         medium  4
  1211.      XVGA  39                                small  3
  1212. Hardware characters  129                Memory update function  305
  1213.      graphics modes  133                Mickeys  269
  1214.      height  137                        Microsoft BASIC PDS  11
  1215.      side effects  136                  Microsoft C  3, 13
  1216.      text modes  129                    Microsoft C++  3, 13
  1217. HERCFIX  314, 315                       Microsoft FORTRAN  3, 14
  1218. Hidden page  151, 225                   Microsoft Mouse  267
  1219. HIMEM.SYS  162                          Microsoft QuickBASIC  3, 16
  1220. Hot spot  277                           Microsoft QuickC  3, 18
  1221. Image array  201                        Microsoft Visual Basic for DOS
  1222. Image buffer  186                                 3, 20
  1223. Images  172                             Microsoft Visual C++  3, 22
  1224.      clipped  203                       Mode X  39
  1225.      regular  195                       Mouse  266
  1226.      reversed  203                           button status  271
  1227.      reversed clipped  203                   CGA Considerations  278
  1228.      without transparent pixels              cursor  269, 273
  1229.           203                                cursor mask  273, 275
  1230. INCLUDE environment variable  6              cursor visibility  269
  1231. Input devices  260                           default cursor  275
  1232. INSTALL program  4                           hot spot  277
  1233.      /L option  5                            initialize  267
  1234. Installation  4                              limits  269
  1235. Interrupts  322                              position  269, 271
  1236. INTRFACE.FOR  6                              screen mask  273, 275
  1237. Joystick  279                                screen updates  269
  1238.      button status  280, 281,                speed  269
  1239.           322                                SVGA  268
  1240.      calibration  280                        XVGA  268
  1241.      characteristics  280               Mouse cursor  269, 273
  1242.      horizontal position  280                graphics modes  275
  1243.      initialize  279                         hot spot  277
  1244.      keyboard emulation  281                 text modes  273
  1245.      special considerations             Mouse driver  266
  1246.           283                           Music  289
  1247. 340   Fastgraph User's Guide
  1248.  
  1249. Music (cont.)                                unfilled  112
  1250.      asynchronous  293                  Region fill  121
  1251.      restarting  295                    Register preservation  318
  1252.      stopping  294                      Resolution  32
  1253.      suspending  295                    Reverse video  132
  1254.      synchronous  289                   RGB color mapping  89
  1255. Music commands  289                     Rubberband boxes  102, 113
  1256. Music string  289, 293                  Scan codes  265
  1257. Musical notes  289                      Screen dissolving  250
  1258. Naming conventions  5                   Screen mask  273, 275
  1259. NumLock  262-264                        Screen origin  255
  1260. Overscan  71                            Screen space  60, 61
  1261. Packed pixel run file  176, 179         Scrolling  252
  1262. Packed pixel run map  180, 213               circular  252
  1263. Page flipping  246, 247, 306,                end-off  252
  1264.           307                                increment  252
  1265. Palette  33                                  region  252
  1266. Palette number  73, 76, 78, 79,         ScrollLock  262, 263
  1267.           82                            SETMEM (BASIC function)  161
  1268. Palette registers  73, 76, 78,          Shadow  132
  1269.           79, 81, 83, 90, 91            Sliding tone  287
  1270. Palette value  73, 76, 78, 79           SNAPSHOT  181, 310, 311, 313,
  1271. Palettes  73, 76, 78, 79, 81,                     314
  1272.           83                                 error tone  310
  1273. Panning  164, 257, 306                       image files  310
  1274. PC Paintbrush  172                           success tone  310
  1275. PCOPTION environment variable           Software characters  139
  1276.           6                                  alternate font  139, 140,
  1277. PCX file  172                                     143
  1278.      creating  172                           angle  143
  1279.      displaying  172                         aspect ratio  140
  1280.      video mode compatibility                font change operator (\)
  1281.           174                                     141
  1282. PCXHEAD  315                                 primary font  139, 140
  1283. Periodic noise  288                          size  140
  1284. Physical pages  150                          string length  144
  1285. Pixel bleeding  279                          subscript operator (\v)
  1286. Pixel run  177                                    142
  1287. Pixel run file  176, 178, 180,               superscript operator (\^)
  1288.           181, 214                                142
  1289. Pixel run map  177, 181, 212                 underline operator (_)  142
  1290. Pixels  32                              Sound  286
  1291. Points  99                                   asynchronous  290
  1292. Polygon                                      disk accesses during  291
  1293.      filled  107, 108                        duration  286
  1294.      unfilled  105-107                       frequency  286
  1295.      vertex offsets  107                     PCjr  286
  1296. Power C  3, 23                               stopping  294
  1297. PPR file  176, 179                           synchronous  286
  1298. Put_string  131                              Tandy  286
  1299. QuickBASIC  3, 16                            volume  286
  1300. QuickC  3, 18                           Sound effects  286-288
  1301. READ.ME file  5                         Splitter cable  279
  1302. Real-time operations  300               SPR file  176
  1303. Rectangles                              Standard color set  70
  1304.      dithered  114                      Standard pixel run file  176
  1305.      solid  111                         Strlen  131
  1306.                                                                    Index   341
  1307.  
  1308. Stroke characters  139                       mode 23  40
  1309. SuperVGA  51                                 mode 24  40
  1310. SVGA  51                                     mode 25  40
  1311.      chipset  52                             mode 26  40
  1312.      dual banks  224                         mode 27  41
  1313.      initialization  53-55                   mode 28  41
  1314.      kernel  40, 52-56                       mode 29  41
  1315.      kernel version  54, 55                  mode X  39
  1316.      monitor compatibility  56               summary  32
  1317.      problematic cards  56              Video page resizing  257
  1318.      supported chipsets  52, 53         Video pages  33, 150
  1319.      VESA compatibility  52, 53              active  151, 152
  1320.      video memory present  55                hidden  151, 225
  1321. Texas Instruments SN76496A                   logical  162
  1322.           sound chip  286                    physical  150
  1323. Text cursor  44, 129, 159                    preserving  160, 166
  1324. Text modes  32, 33, 68                       resizing  164
  1325.      43 lines  47                            segment address  160
  1326.      50 lines  47                            virtual  150, 154
  1327.      color  68                               visual  151, 152
  1328.      monochrome  69                     Video subsystem  33
  1329. TI sound chip  286                      Virtual colors  90, 91
  1330. Transparency  190, 195, 197,            Virtual pages  150
  1331.           198, 200, 201, 203,                creating  154
  1332.           204, 212, 215, 218,                heap requirements  161
  1333.           231, 232, 233                      page flipping  161
  1334. Turbo C  3, 25                               releasing  155
  1335. Turbo C++  3, 25                             writing to unallocated  162
  1336. Turbo Pascal  3, 27                     Visual Basic  3, 20
  1337. Vector characters  139                  Visual C++  3, 22
  1338. Vertical retrace  306                   Visual effects  251
  1339. VESA  52, 53                            Visual page  151, 152
  1340. Video DAC registers  81-84, 86,         Warbling  287
  1341.           90, 306                       White noise  288
  1342.      EGA modes  87                      World space  60, 62
  1343. Video modes  32                         XMS  162
  1344.      mode 00  34                        XOR boxes  113
  1345.      mode 01  34                        XOR lines  102
  1346.      mode 02  34                        XOR pixels  101
  1347.      mode 03  34                        Zortech C++  3, 28
  1348.      mode 04  35
  1349.      mode 05  35
  1350.      mode 06  36
  1351.      mode 07  35
  1352.      mode 09  36
  1353.      mode 11  36
  1354.      mode 12  37
  1355.      mode 13  37
  1356.      mode 14  37
  1357.      mode 15  37
  1358.      mode 16  38
  1359.      mode 17  38
  1360.      mode 18  38
  1361.      mode 19  39
  1362.      mode 20  39
  1363.      mode 21  39
  1364.      mode 22  39
  1365.